import React, {Component} from 'react'
import {connect} from 'dva'
import Login from '../../components/Login'

@connect(({loading}) => ({
  submitting: loading.effects['user/login'],
}))
class LoginPage extends Component {
  handleSubmit = (values) => {
    this.props.dispatch({
      type: 'user/login',
      payload: values,
    })
  }
  render() {
    const {submitting} = this.props
    return (
      <Login
        loading={submitting}
        onSubmit={this.handleSubmit}
      />
    )
  }
}

export default LoginPage
